function initExt(viewModel, requestUtils) {
  // 在这里写业务逻辑
  // 字段编辑后处理
  //单据新增修改【实际调整数】值改变时：重新计算 经费总额、实际可用经费余额
  viewModel.get("actual_modify").on("afterValueChange", function (data) {
    debugger;
    let value = data.value || 0;
    // 下拨预算
    let budget = viewModel.get("budget").getValue() || 0;
    // 实际占用
    let actual_occupy = viewModel.get("actual_occupy").getValue() || 0;
    // 经费总额 = 下拨预算 + 实际调整数
    let total_budget = budget + value;
    // 实际可用 = 经费总额 - 实际占用
    let actual_budget = total_budget - actual_occupy;
    viewModel.get("total_budget").setValue(total_budget);
    viewModel.get("actual_budget").setValue(actual_budget);
  });

  //单据新增【下拨预算】值改变时：重新计算 经费总额、实际可用经费余额
  viewModel.get("budget").on("afterValueChange", function (data) {
    debugger;
    // 下拨预算
    let budget = viewModel.get("budget").getValue() || 0;
    // 实际占用
    let actual_occupy = viewModel.get("actual_occupy").getValue() || 0;

    let actual_modify = viewModel.get("actual_modify").getValue() || 0;
    // 经费总额 = 下拨预算 + 实际调整数
    let total_budget = budget + actual_modify;
    // 实际可用 = 经费总额 - 实际占用
    let actual_budget = total_budget - actual_occupy;
    viewModel.get("total_budget").setValue(total_budget);
    viewModel.get("actual_budget").setValue(actual_budget);
  });
}

cb.define(
  process.env.__DOMAINKEY__,
  ["common/requestUtils.js"],
  function (requestUtils) {
    let vm = {
      doAction: function (name, viewModel) {
        if (this[name]) this[name](viewModel);
      },
      init: function (viewModel) {
        initExt(viewModel, requestUtils);
      },
    };
    try {
      module.exports = vm;
    } catch (error) {
      console.log(error);
    }
    return vm;
  }
);
